/*   1:    */ package com.tanke;
/*   2:    */ 
/*   3:    */ import java.util.Vector;
/*   4:    */ 
/*   5:    */ class Enemy
/*   6:    */   extends Tanke
/*   7:    */   implements Runnable
/*   8:    */ {
/*   9:260 */   Vector<Shot> ss = new Vector();
/*  10:    */   
/*  11:    */   public Enemy(int x, int y)
/*  12:    */   {
/*  13:263 */     super(x, y);
/*  14:264 */     this.direct = ((int)(3.0D * Math.random()));
/*  15:    */   }
/*  16:    */   
/*  17:    */   public void shotHero()
/*  18:    */   {
/*  19:268 */     Shot s = null;
/*  20:269 */     switch (this.direct)
/*  21:    */     {
/*  22:    */     case 0: 
/*  23:272 */       s = new Shot(this.x, this.y - 20, 0);
/*  24:273 */       this.ss.add(s);
/*  25:274 */       break;
/*  26:    */     case 1: 
/*  27:276 */       s = new Shot(this.x + 20, this.y, 1);
/*  28:277 */       this.ss.add(s);
/*  29:278 */       break;
/*  30:    */     case 2: 
/*  31:280 */       s = new Shot(this.x, this.y + 20, 2);
/*  32:281 */       this.ss.add(s);
/*  33:282 */       break;
/*  34:    */     case 3: 
/*  35:284 */       s = new Shot(this.x - 20, this.y, 3);
/*  36:285 */       this.ss.add(s);
/*  37:    */     }
/*  38:288 */     Thread t = new Thread(s);
/*  39:289 */     t.start();
/*  40:    */   }
/*  41:    */   
/*  42:    */   public void run()
/*  43:    */   {
/*  44:293 */     while (this.isLive)
/*  45:    */     {
/*  46:295 */       switch (this.direct)
/*  47:    */       {
/*  48:    */       case 0: 
/*  49:298 */         if (this.ss.size() < 5) {
/*  50:299 */           shotHero();
/*  51:    */         }
/*  52:300 */         for (int i = 0; i < 30; i++)
/*  53:    */         {
/*  54:    */           try
/*  55:    */           {
/*  56:303 */             Thread.sleep(100L);
/*  57:    */           }
/*  58:    */           catch (InterruptedException e)
/*  59:    */           {
/*  60:306 */             e.printStackTrace();
/*  61:    */           }
/*  62:308 */           if (this.y > 15)
/*  63:    */           {
/*  64:309 */             this.y -= this.speed;
/*  65:    */           }
/*  66:    */           else
/*  67:    */           {
/*  68:311 */             this.y = 15;
/*  69:312 */             this.direct = 2;
/*  70:313 */             break;
/*  71:    */           }
/*  72:    */         }
/*  73:316 */         break;
/*  74:    */       case 1: 
/*  75:318 */         if (this.ss.size() < 5) {
/*  76:319 */           shotHero();
/*  77:    */         }
/*  78:320 */         for (int i = 0; i < 30; i++)
/*  79:    */         {
/*  80:    */           try
/*  81:    */           {
/*  82:323 */             Thread.sleep(100L);
/*  83:    */           }
/*  84:    */           catch (InterruptedException e)
/*  85:    */           {
/*  86:326 */             e.printStackTrace();
/*  87:    */           }
/*  88:328 */           if (this.x < 385)
/*  89:    */           {
/*  90:329 */             this.x += this.speed;
/*  91:    */           }
/*  92:    */           else
/*  93:    */           {
/*  94:331 */             this.x = 385;
/*  95:332 */             this.direct = 3;
/*  96:333 */             break;
/*  97:    */           }
/*  98:    */         }
/*  99:336 */         break;
/* 100:    */       case 2: 
/* 101:338 */         if (this.ss.size() < 5) {
/* 102:339 */           shotHero();
/* 103:    */         }
/* 104:340 */         for (int i = 0; i < 30; i++)
/* 105:    */         {
/* 106:    */           try
/* 107:    */           {
/* 108:343 */             Thread.sleep(100L);
/* 109:    */           }
/* 110:    */           catch (InterruptedException e)
/* 111:    */           {
/* 112:346 */             e.printStackTrace();
/* 113:    */           }
/* 114:348 */           if (this.y < 385)
/* 115:    */           {
/* 116:349 */             this.y += this.speed;
/* 117:    */           }
/* 118:    */           else
/* 119:    */           {
/* 120:351 */             this.y = 385;
/* 121:352 */             this.direct = 0;
/* 122:353 */             break;
/* 123:    */           }
/* 124:    */         }
/* 125:356 */         break;
/* 126:    */       case 3: 
/* 127:358 */         if (this.ss.size() < 5) {
/* 128:359 */           shotHero();
/* 129:    */         }
/* 130:360 */         for (int i = 0; i < 30; i++)
/* 131:    */         {
/* 132:    */           try
/* 133:    */           {
/* 134:363 */             Thread.sleep(100L);
/* 135:    */           }
/* 136:    */           catch (InterruptedException e)
/* 137:    */           {
/* 138:366 */             e.printStackTrace();
/* 139:    */           }
/* 140:368 */           if (this.x > 15)
/* 141:    */           {
/* 142:369 */             this.x -= this.speed;
/* 143:    */           }
/* 144:    */           else
/* 145:    */           {
/* 146:372 */             this.x = 15;
/* 147:373 */             this.direct = 1;
/* 148:374 */             break;
/* 149:    */           }
/* 150:    */         }
/* 151:    */       }
/* 152:380 */       this.direct = ((int)(4.0D * Math.random()));
/* 153:    */     }
/* 154:    */   }
/* 155:    */ }


/* Location:           C:\Users\Cheese\Desktop\坦克大战\坦克大战.jar
 * Qualified Name:     com.tanke.Enemy
 * JD-Core Version:    0.7.0.1
 */